{
 "cells": [
  {
   "cell_type": "raw",
   "metadata": {
    "vscode": {
     "languageId": "raw"
    }
   },
   "source": [
    "---\n",
    "title: Debugging\n",
    "sidebar_position: 1\n",
    "description: Debugging Mojo programs.\n",
    "---"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "The Mojo extension for Visual Studio Code enables you to use VS Code's built-in\n",
    "debugger with Mojo programs. (The Mojo extension also supports debugging C, C++,\n",
    "and Objective-C.)\n",
    "\n",
    "For complete coverage of VS Code's debugging features, see\n",
    "[Debugging in Visual Studio Code](https://code.visualstudio.com/docs/editor/debugging).\n",
    "\n",
    "This page describes the features available through the Mojo extension, as well\n",
    "as current limitations of the Mojo debugger.\n",
    "\n",
    "The Mojo SDK includes the [LLDB debugger](https://lldb.llvm.org/) and a Mojo\n",
    "LLDB plugin. Together these provide the low-level debugging interface for the\n",
    "Mojo extension. You can also use the `mojo debug` command to start a \n",
    "command-line debugging session using LLDB or to launch a Mojo debugging session\n",
    "in VS Code.\n",
    "\n",
    "## Start debugging\n",
    "\n",
    "There are several ways to start a debug session in VS Code.\n",
    "\n",
    "To start debugging, you'll need to have a Mojo project to debug. There are\n",
    "a number of examples ranging from simple to complex in the [Mojo repo on\n",
    "GitHub](https://github.com/modularml/mojo).\n",
    "\n",
    ":::note **VS Code veteran?**\n",
    "\n",
    "If you're already familiar with debugging in VS Code, the\n",
    "material in this section will mostly be review. You might want to skip ahead to\n",
    "[Launch configurations](#launch-configurations)\n",
    "or see [Using the debugger](#using-the-debugger) for notes on the features\n",
    "supported in the Mojo debugger. \n",
    "\n",
    ":::\n",
    "\n",
    "### Quick run or debug\n",
    "\n",
    "If your active editor tab contains a Mojo file with an `fn main()` entry point,\n",
    "one of the quickest ways to run or debug it is using the **Run or Debug** button\n",
    "in the Editor toolbar.\n",
    "\n",
    "![](images/quick-run-or-debug-button.png)\n",
    "\n",
    "To start debugging the current file:\n",
    "\n",
    "- Open the **Run or Debug** dropdown menu and choose **Debug Mojo File** or\n",
    "**Debug Mojo File in Dedicated Terminal**.\n",
    "\n",
    "  ![](images/quick-run-or-debug-menu.png)\n",
    "\n",
    "The two debug configurations differ in how they handle input and output:\n",
    "\n",
    "* **Debug Mojo File** launches the Mojo program detached from any terminal.\n",
    "Standard output and standard error output for the program are displayed in the\n",
    "**Debug Console**. You can't write to the program's standard input, but you can\n",
    "see the program's output and interact with the debugger in a single location.\n",
    "\n",
    "* **Debug Mojo File in Dedicated Terminal** creates a new instance of VS Code's\n",
    "integrated terminal and attaches the program's input and output to the terminal.\n",
    "This lets you interact with the program's standard input, standard output and\n",
    "standard error output in the terminal, while the **Debug Console** is used only\n",
    "for interactions with the debugger.\n",
    "\n",
    "The **Run or Debug** button uses predefined launch configurations. There's\n",
    "currently no way to modify the `args`, `env`, `cwd` or other settings for\n",
    "programs launched with the **Run or Debug** configurations. If you need to\n",
    "customize any of these things, see [Edit launch\n",
    "configurations](#edit-launch-configurations).\n",
    "\n",
    "After you choose one of the debug configurations, the button updates to show\n",
    "the debug symbol. Click the button to re-run the previous configuration.\n",
    "\n",
    "![](images/quick-run-or-debug-button-debug.png)."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "\n",
    "### Run and Debug view\n",
    "\n",
    "The **Run and Debug** view includes a button to launch debug sessions and a\n",
    "menu to select debug configurations. It also has areas to display current\n",
    "variables, watch expressions, the current call stack, and breakpoints.\n",
    "\n",
    "<figure>\n",
    "\n",
    "![](images/run-and-debug-view.png)\n",
    "\n",
    "<figcaption><b>Figure 1.</b> Run and Debug view</figcaption>\n",
    "</figure>\n",
    "\n",
    "To open **Run and Debug** view, click the **Run and Debug** icon in the\n",
    "**Activity Bar** (on the left side of the VS Code window) or press\n",
    "<kbd>Control+Shift+D</kbd> \n",
    "(<kbd>Command+Shift+D</kbd> on macOS).\n",
    "\n",
    "![](images/run-and-debug-icon.png)\n",
    "\n",
    "If you haven't created any launch configurations in the current project,\n",
    "VS Code shows the **Run start view**.\n",
    "\n",
    "<figure>\n",
    "\n",
    "![](images/run-start-view.png)\n",
    "\n",
    "<figcaption><b>Figure 2.</b> Run start view</figcaption>\n",
    "</figure>\n",
    "\n",
    "If you've already launched a debug session or created a `launch.json` file to\n",
    "define launch configurations, you'll see the **Launch configurations** menu,\n",
    "which lets you choose configurations and start debug sessions:\n",
    "\n",
    "<figure>\n",
    "\n",
    "![](images/launch-configuration-menu.png)\n",
    "\n",
    "<figcaption><b>Figure 3.</b> Launch configurations menu</figcaption>\n",
    "</figure>\n",
    "\n",
    "### Other ways to start a debug session\n",
    "\n",
    "There are a number of other ways to start a debug session.\n",
    "\n",
    "#### Launching from the Command Palette\n",
    "\n",
    "If you have a Mojo file open in your active editor, you can also start a debug\n",
    "session from the **Command Palette**.\n",
    "\n",
    "1. Click **View** > **Command Palette** or press <kbd>Control+Shift+P</kbd>\n",
    "(<kbd>Command+Shift+P</kbd> on macOS). \n",
    "\n",
    "2. Enter \"Mojo\" at the prompt to bring up the Mojo commands. You should see the\n",
    "same debug configurations described in [Quick run or\n",
    "debug](#quick-run-or-debug).\n",
    "\n",
    "#### Launch from the File Explorer\n",
    "\n",
    "To launch a debug session from the the **File Explorer** view:\n",
    "\n",
    "1. Right-click on a Mojo file.\n",
    "2. Select a Mojo debug configuration.\n",
    "\n",
    "You should see the same debug configurations described in [Quick run or\n",
    "debug](#quick-run-or-debug). \n",
    "\n",
    "#### Debug with F5\n",
    "\n",
    "Press F5 to start a debug session using the current debug configuration.\n",
    "\n",
    "If you don't have any existing debug configurations available to select, and\n",
    "your active editor contains a Mojo file with an `fn main()` entry point,\n",
    "pressing F5 will launch and debug the current file using the **Debug Mojo\n",
    "File** action described in [Quick run or debug](#quick-run-or-debug)."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": []
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Starting the debugger from the command line\n",
    "\n",
    "Use the `mojo debug` command to start a debug session from the command line. You\n",
    "can choose from two debugging interfaces:\n",
    "\n",
    "- With the `--vscode` flag, `mojo debug` starts a debug session on VS Code if\n",
    "  it's running and the Mojo extension is enabled.\n",
    "\n",
    "- Without the `--vscode` flag, `mojo debug` starts a command-line [LLDB \n",
    "  debugger](https://lldb.llvm.org/) session.\n",
    "\n",
    "You can choose to build and debug a Mojo file, run and debug a compiled binary,\n",
    "or to attach the debugger to a running process.\n",
    "\n",
    ":::note Environment variables\n",
    "\n",
    "When you debug a program from the command line using `--vscode`, the program runs\n",
    "with the environment variables set in the terminal. When launching from inside\n",
    "VS Code via the GUI, the environment is defined by the VS Code [launch \n",
    "configuration](#launch-configurations).\n",
    "\n",
    ":::\n",
    "\n",
    "For a full list of command-line options, see the [`mojo debug` reference\n",
    "page](/mojo/cli/debug).\n",
    "\n",
    "### Start a debug session from the command line\n",
    "\n",
    "With VS Code open, run the following command (either from VS Code's integrated\n",
    "terminal or an external shell):\n",
    "\n",
    "```bash\n",
    "mojo debug --vscode myproject.mojo\n",
    "```\n",
    "\n",
    "Or to debug a compiled binary:\n",
    "\n",
    "```bash\n",
    "mojo debug --vscode myproject\n",
    "```\n",
    "\n",
    "\n",
    "For best results, build with the `-O0 -g` command-line options when you build a\n",
    "binary that you intend to debug—this produces a binary with full debug info.\n",
    "(When you call `mojo debug` on a Mojo source file, it includes debug\n",
    "information by default.) See the [`mojo build` reference page](/mojo/cli/build)\n",
    "for details on compilation options.\n",
    "\n",
    "### Attach the debugger to a running process from the command line\n",
    "\n",
    "You can also attach the debugger to a running process by specifying either the\n",
    "process ID or process name on the command line:\n",
    "\n",
    "```bash\n",
    "mojo debug --vscode --pid <PROCESS_ID>\n",
    "```\n",
    "\n",
    "Or:\n",
    "\n",
    "```bash\n",
    "mojo debug --vscode --process-name <PROCESS_NAME>\n",
    "```"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Launch configurations\n",
    "\n",
    "VS Code _launch configurations_ let you define setup information for debugging\n",
    "your applications.\n",
    "\n",
    "The Mojo debugger provides the following launch configuration templates:\n",
    "\n",
    "* Debug current Mojo file. Launches and debugs the Mojo file in the active\n",
    "editor tab. Effectively the same as the **Debug Mojo File** action described in\n",
    "[Quick run or debug](#quick-run-or-debug), but with more configuration options.\n",
    "\n",
    "* Debug Mojo file. Like the previous entry, except that it identifies a\n",
    "specific file to launch and debug, no matter what file is displayed in the\n",
    "active editor.\n",
    "\n",
    "* Debug binary. This configuration operates on a prebuilt binary, which could\n",
    "be written in any mixture of languages supported by LLDB (Mojo, C, C++, etc.).\n",
    "You need to set the `program` field to the path of your binary. \n",
    "\n",
    "* Attach to process. Launches a debug session attached to a running process. On\n",
    "launch, you choose the process you want to debug from a list of running\n",
    "processes.\n",
    "\n",
    "You can edit any of these templates to customize them. All VS Code launch\n",
    "configurations must contain the following attributes:\n",
    "\n",
    "- `name`. The name of the launch configuration, which shows up in the UI (for\n",
    "  example, \"Run current Mojo file\").\n",
    "- `request`. Can be either `launch` (to run a program from VS Code) or `attach` \n",
    "  (to attach to and debug a running file). \n",
    "- `type`. Use `mojo-lldb` for the Mojo debugger.\n",
    "\n",
    "In addition, Mojo launch configurations can contain the following attributes:\n",
    "\n",
    "- `args`. Any command-line arguments to be passed to the program.\n",
    "- `cwd`. The current working directory to run the program in.\n",
    "- `description`. A longer description of the configuration, not shown in the UI.\n",
    "- `env`. Environment variables to be set before running the program.\n",
    "- `mojoFile`. Path to a Mojo file to launch and debug.\n",
    "- `pid`. Process ID of the running process to attach to.\n",
    "- `program`. Path to a compiled binary to launch and debug, or the \n",
    "  program to attach to.\n",
    "- `runInTerminal`. True to run the program with a dedicated terminal, which\n",
    "  allows the program to receive standard input from the terminal. False to run\n",
    "  the program with its output directed to the **Debug Console**.\n",
    "\n",
    "If configuration is a `launch` request, the configuration must include either\n",
    "the `mojoFile` or `program` attribute.\n",
    "\n",
    "For `attach` requests, the configuration must include either the `pid` or \n",
    "`program` attribute.\n",
    "\n",
    "VS Code performs variable substitution on the launch configurations. You can\n",
    "use `${workspaceFolder}` to substitute the path to the current workspace, and\n",
    "`${file}` to represent the file in the active editor tab. For a complete list\n",
    "of variables, see the VS Code [Variables\n",
    "reference](https://code.visualstudio.com/docs/editor/variables-reference).\n",
    "\n",
    "For more information, see the VS Code documentation for [Launch \n",
    "configurations](https://code.visualstudio.com/docs/editor/debugging#_launch-configurations).\n",
    "\n",
    ":::note Compilation options\n",
    "\n",
    "Mojo launch configurations don't allow you to specify compilation options. If\n",
    "you need to specify compilation options, you can build the binary using [`mojo\n",
    "build`](/mojo/cli/build), then use a launch configuration with the `program`\n",
    "option to launch the compiled binary. Or if you [start the debugger from the\n",
    "command line](#starting-the-debugger-from-the-command-line), you can pass\n",
    "compilation options to the `mojo debug` command.\n",
    "\n",
    ":::\n",
    "\n",
    "### Edit launch configurations\n",
    "\n",
    "To edit launch configurations:\n",
    "\n",
    "1. If the **Run and Debug** view isn't already open, click the **Run and\n",
    "Debug** icon in the **Activity Bar** (on the left side of the VS Code window)\n",
    "or press <kbd>Control+Shift+D</kbd> (<kbd>Command+Shift+D</kbd> on macOS).\n",
    "\n",
    "   ![](images/run-and-debug-icon.png)\n",
    "  \n",
    "1. Create or open the `launch.json` file:\n",
    "    1. If you see the **Run start view**, click **create a launch.json file**.\n",
    "    1. If you already have launch configurations set up, click the gear icon\n",
    "    next to the **Launch configurations** menu.\n",
    "       ![](images/launch-configuration-menu.png)\n",
    "1. Select **Mojo** from the list of debuggers.\n",
    "\n",
    "VS Code opens the new `launch.json` file in an editor tab, with templates for\n",
    "some common debug actions. Click **Add configuration** to add a new\n",
    "configuration template. "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Using the debugger\n",
    "\n",
    "When a debug session is running, use the debug toolbar to pause, continue, and\n",
    "step through the program.\n",
    "\n",
    "![](images/debug-toolbar.png)\n",
    "\n",
    "The buttons on the toolbar are:\n",
    "\n",
    "- **Continue/Pause**: If the program is stopped, resume the normal execution of the\n",
    "program up to the next breakpoint, signal or crash. Otherwise, pause all the\n",
    "threads of the program at once.\n",
    "\n",
    "- **Step Over**: Execute the next line of code without stopping at function calls.\n",
    "\n",
    "- **Step Into**: Execute the next line of code and stop at the first function call. If the program is stopped just before a function call, steps into the function so you can step through it line-by-line.\n",
    "\n",
    "- **Step Out**: Finish the execution of the current function and stop right after\n",
    "returning to the parent function. \n",
    "\n",
    "- **Restart**: If this is a `launch` session, terminate the current program and\n",
    "restart the debug session. Otherwise, detach from the target process and\n",
    "reattach to it. \n",
    "\n",
    "- **Stop**: If this is a `launch` session, terminate the current program. Otherwise,\n",
    "detach from the target process without killing it.\n",
    "\n",
    "The debugger currently has the following limitations:\n",
    "\n",
    "- No support for breaking automatically on Mojo errors.\n",
    "\n",
    "- When stepping out of a function, the returned value is not displayed.\n",
    "\n",
    "- LLDB doesn’t support stopping or resuming individual threads."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Breakpoints\n",
    "\n",
    "The Mojo debugger supports setting [standard \n",
    "breakpoints](https://code.visualstudio.com/docs/editor/debugging#_breakpoints),\n",
    "[logpoints](https://code.visualstudio.com/docs/editor/debugging#_logpoints), and\n",
    "[triggered breakpoints](https://code.visualstudio.com/docs/editor/debugging#_triggered-breakpoints), \n",
    "as described in the VS Code documentation.\n",
    "The Mojo debugger also supports _error breakpoints_ (also known as \"break on\n",
    "raise\"), which break whenever a `raise` statement is executed.\n",
    "\n",
    "When debugging Mojo code, the debugger doesn't support function breakpoints,\n",
    "data breakpoints, or conditional breakpoints based on an expression (it does \n",
    "support hit counts, which VS Code classifies as a kind of conditional \n",
    "breakpoint).\n",
    "\n",
    "When editing a breakpoint, you're offered four options:\n",
    "\n",
    "- **Expression**. Set a conditional breakpoint (not currently supported).\n",
    "- **Hit Count**. Add a hit count to a breakpoint (supported).\n",
    "- **Log Message**. Add a logpoint (supported)\n",
    "- **Wait for Breakpoint**. Add a triggered breakpoint (supported).\n",
    "\n",
    "#### Set a hit count breakpoint\n",
    "\n",
    "A hit count breakpoint is a breakpoint that only breaks execution after the\n",
    "debugger hits it a specified number of times.\n",
    "\n",
    "To add a hit count breakpoint:\n",
    "\n",
    "1. Right click in the left gutter of the editor where you want to place the \n",
    "  breakpoint, and select **Add Conditional Breakpoint.**\n",
    "2. Select **Hit Count** from the menu and enter the desired hit count.\n",
    "\n",
    "To change an existing breakpoint to a hit count breakpoint:\n",
    "\n",
    "1. Right click on the breakpoint in the left gutter of the editor and select\n",
    "  **Edit breakpoint**.\n",
    "2. Select **Hit Count** from the menu and enter the desired hit count.\n",
    "\n",
    "You can also edit a breakpoint from the **Breakpoints** section of the **Run and\n",
    "Debug** view:\n",
    "\n",
    "- Right-click on the breakpoint and select **Edit Condition**, or,\n",
    "- Click the **Edit Condition** icon next to the breakpoint.\n",
    "\n",
    "This brings up the same menu, **next to the breakpoint in the editor tab**.\n",
    "\n",
    "#### Enable error breakpoints\n",
    "\n",
    "You can enable and disable error breakpoints in VS Code by selecting \"Mojo\n",
    "Raise\" in the **Breakpoints** section of the **Run and Debug** view. If enabled\n",
    "during debugging, executing a `raise` statement causes the debugger to stop\n",
    "execution and highlight the line of code where the error was raised.\n",
    "\n",
    "![VS Code window showing a program paused in the debugger with the Run and Debug view visible. The program is paused at a raise statement.](images/break-on-raise.png)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### View local variables\n",
    "\n",
    "When a program is paused in the debugger, the editor shows local variable values\n",
    "inline. You can also find them in the **Variables** section of the **Run and\n",
    "Debug** view.\n",
    "\n",
    "<figure>\n",
    "\n",
    "![VS Code window showing a program paused in the debugger, with the variables sections of the Run and Debug view visible. The edit shows three functions (nested2, nested1, and main). The program is paused at a breakpoint in nested2.](images/debugger-variables.png)\n",
    "\n",
    "<figcaption><b>Figure 4.</b> Local variable values displayed in the debugger</figcaption>\n",
    "</figure>\n"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### View the call stack\n",
    "\n",
    "When a program is paused in the debugger, the **Run and Debug** view shows the\n",
    "current call stack. (You may see multiple call stacks, one for each active\n",
    "thread in the program.)\n",
    "\n",
    "<figure>\n",
    "\n",
    "![VS Code window showing a program paused in the debugger, with the call stack and variables sections of the Run and Debug view visible. The call stack shows three functions (nested2, nested1, and main). The program is paused at a breakpoint in nested2; the parent function nested1 is selected in the call stack, and editor highlights the current line in nested1 (the call to nested2()).](images/debugger-call-stack-nested1.png)\n",
    "\n",
    "<figcaption><b>Figure 5.</b> Call stack in Run and Debug view</figcaption>\n",
    "</figure>\n",
    "\n",
    "The **Call Stack** section of the Run and Debug view shows a stack frame for\n",
    "each function call in the current call stack. Clicking on the name of the\n",
    "function highlights the current line in that function. For example, in Figure\n",
    "5, the program is paused at a breakpoint in `nested2()`, but the parent\n",
    "function, `nested1()` is selected in the call stack. The editor highlights the\n",
    "current line in `nested1()` (that is, the call to `nested2()`) and shows the\n",
    "current local variable values for `nested1()`."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Use the Debug Console\n",
    "\n",
    "The **Debug Console** gives you a command-line interface to the debugger. The \n",
    "**Debug Console** processes LLDB commands and Mojo expressions.\n",
    "\n",
    "Anything prefixed with a colon (`:`) is treated as an LLDB command. Any other\n",
    "input is treated as an expression.\n",
    "\n",
    "Currently Mojo expressions are limited to inspecting variables and their fields.\n",
    "The console also supports subscript notation (`vector[index]`) for certain data\n",
    "structures in the standard library, including  `List`, `SIMD`,\n",
    "and `ListLiteral`. \n",
    "\n",
    "In the future, we intend to provide a way for arbitrary data structures to\n",
    "support subscript notation in the **Debug Console**.\n",
    "\n",
    ":::note \n",
    "\n",
    "The **Debug Console** only accepts input when the program is paused.\n",
    "\n",
    ":::"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Tips and tricks\n",
    "\n",
    " There are several features in the standard library that aren't directly related\n",
    " to the debugger, but which can help you debug your programs. These include:\n",
    "\n",
    " * Programmatic breakpoints.\n",
    " * Setting parameters from the Mojo command line.\n",
    "\n",
    " ### Set a programmatic breakpoint\n",
    "\n",
    " To break at a specific point in your code, you can use the built-in\n",
    " [`breakpoint()`](/mojo/stdlib/builtin/breakpoint/breakpoint) function:\n",
    "\n",
    " ```mojo\n",
    "if some_value.is_valid():\n",
    "    do_the_right_thing()\n",
    "else:\n",
    "    # We should never get here!\n",
    "    breakpoint()\n",
    "```\n",
    "\n",
    "If you have VS Code open and run this code in debug mode (either using VS Code\n",
    "or `mojo debug`), hitting the `breakpoint()` call causes an error, which\n",
    "triggers the debugger.\n",
    "\n",
    ":::note Assertions\n",
    "\n",
    "The [`testing`](/mojo/stdlib/testing/testing/) module includes a number of \n",
    "ways to specify assertions. Assertions also trigger an error, so can open the \n",
    "debugger in the same way that a `breakpoint()` call will.\n",
    "\n",
    ":::\n",
    "\n",
    "### Set parameters from the Mojo command line\n",
    "\n",
    "You can use the [`param_env`](/mojo/stdlib/sys/param_env/) module to retrieve\n",
    "parameter values specified on the Mojo command line. Among other things, this\n",
    "is an easy way to switch debugging logic on and off. For example:\n",
    "\n",
    "```mojo\n",
    "from param_env import is_defined\n",
    "\n",
    "def some_function_with_issues():\n",
    "    # ...\n",
    "    @parameter\n",
    "    if is_defined[\"DEBUG_ME\"]():\n",
    "        breakpoint()\n",
    "```\n",
    "\n",
    "To activate this code, use the [`-D` command-line\n",
    "option](/mojo/cli/debug#compilation-options) to define `DEBUG_ME`:\n",
    "\n",
    "```bash\n",
    "mojo debug -D DEBUG_ME main.mojo\n",
    "```\n",
    "\n",
    "The `is_defined()` function returns a compile-time true or false value based on\n",
    "whether the specified name is defined. Since the `breakpoint()` call is inside a\n",
    "[parametric `if` statement](/mojo/manual/decorators/parameter#parametric-if-statement),\n",
    "it is only included in the compiled code when the `DEBUG_ME` name is defined on\n",
    "the command line."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Troubleshooting\n",
    "\n",
    "### `error: can't connect to the RPC debug server socket`\n",
    "\n",
    "If using `mojo debug --rpc` gives you the message `error: can't connect to the RPC debug server socket: Connection refused`, try the following possible fixes:\n",
    "\n",
    " * Make sure VS Code is open.\n",
    " * If VS Code is already open, try restarting VS Code.\n",
    " * If there are other VS Code windows open, try closing them and then restarting. This error can sometimes occur when multiple windows have opened and closed in certain orders.\n",
    "\n",
    "### `error: couldn't get a valid response from the RPC server`\n",
    "\n",
    "If using `mojo debug --rpc` gives you the message `error: couldn't get a valid response from the RPC server`, try the following possible fixes:\n",
    "\n",
    " * Make sure VS Code is open to a valid Mojo codebase. This error can sometimes happen if the VS Code window is open to some other codebase.\n",
    " * If there are multiple VS Code windows open, try closing all but the one you wish to debug in.\n",
    " * Restart VS Code.\n",
    " * Reinstall the SDK and restart VSCode.\n",
    " * If you are working on a development version of the SDK, make sure that all SDK tools are properly built with your build system, and then reload VSCode.\n",
    " * As a last resort, restarting your entire computer can fix this problem.\n",
    "\n",
    "If these steps don't help, please file an issue. We'd love your help identifying possible causes and fixes!"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Mojo",
   "language": "mojo",
   "name": "mojo-jupyter-kernel"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "mojo"
   },
   "file_extension": ".mojo",
   "mimetype": "text/x-mojo",
   "name": "mojo"
  },
  "orig_nbformat": 4
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
